<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		
		<style>
			
			#container{
				border: 1px solid red;
				
				width: auto;
				
				height: auto;
				overflow: hidden;
				
				margin: 0px auto;
			}
			
			.row9{
				/*border: 2px solid gray;*/
				width: auto;
				height: auto;
				overflow: hidden;
				margin: 2px;
			}
			
			.cell81{
				width: 90px;
				text-align: center;
				height: 30px;
				line-height: 30px;
				border: 2px solid red;
				float: left;
				margin: 2px;
				
				font-family: "微软雅黑";
				font-size: 14px;
			}
		</style>
	</head>
	<body>
		
		<!--<div id="container">
			<div class="row9">
				<div class="cell81">
					1x1=1
				</div>
			</div>
			<div class="row9">
				<div class="cell81" ymd='20161103150130444'>
					2x1=1
				</div>
				<div class="cell81">
					2x2=2
				</div>
			</div>
		</div>-->
		
		
		<script>
			//1 做1个最外层的div id=container
			
			var c = document.createElement("div");
			
			c.setAttribute('id','container');
			
			
			for(var outer =1 ; outer<=9; outer++){
				//行
				var h = document.createElement("div");
				h.setAttribute('class','row9');
				
				
				//列
				for(var inner =1; inner<=outer;inner++){
					var cell = document.createElement("div");
					cell.setAttribute('class','cell81');
					
					//设置自定义属性
					
					var d = new Date();
					var year  = d.getFullYear();
					var month = d.getMonth()+1;
					var da    = d.getDate();
					var hour  = d.getHours();
					var min   = d.getMinutes();
					var sec   = d.getSeconds();
					var msec  = d.getMilliseconds(); //毫秒
					console.log(msec);
					var detailTime=''+year+month+da+hour+min+sec+msec;
					
					cell.setAttribute('ymd',detailTime);
					
					
					var b =  outer + " x "+ inner +" = " + outer*inner; 
					cell.innerText=b;
					//把单元格增加到行里面去
					h.appendChild(cell);
				}
				
				
				
				c.appendChild(h);
				
			}
			
			//把id=container的div增加到body标签
			document.body.appendChild(c);
			
			
			
			
		</script>
	</body>
</html>
